package tags;

import dao.tro.Airport;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;

public class InsertSingleAirport extends TagSupport {
    private Airport airport;

    public Airport getAirport() {
        return airport;
    }

    @Override
    public void release() {
        setAirport(null);
        super.release();
    }

    @Override
    public int doStartTag() {
        return EVAL_BODY_INCLUDE;
    }

    @Override
    public int doEndTag() throws JspException {
        pageContext.setAttribute("singleAirport", airport, PageContext.REQUEST_SCOPE);
        try {
            pageContext.include("../Templates/Airport.jsp");
        } catch (Exception e) {
            throw new JspException(e.getMessage());
        }
        return EVAL_PAGE;
    }

    public void setAirport(Airport airport) {
        this.airport = airport;
    }
}